home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Extra 1997 #2 / Amiga Plus Extra 1997 #2.iso / pd / misc / macro / scanner / typedefs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-16  |  1.0 KB  |  55 lines

  1.  
  2.  
  3. /*
  4. **  ***********************************************************************
  5. **
  6. **  ScanHandlerTypeDefs (c) by Stefan Schor
  7. **
  8. **  ***********************************************************************
  9. */
  10.  
  11.  
  12. #include <exec/types.h>
  13.  
  14. #define UPPER(a) ((a) & 95)
  15.  
  16. __asm
  17. ULONG
  18. ScanHandlerTypeDefs(register __d0 ULONG len, register __a0 char **text)
  19. {
  20.     const char *version = "$VER: TypeDefs 1.0 (24.3.94)";
  21.  
  22.     if (len > 8)
  23.     {
  24.         char *pos  = *text;
  25.         char *last = *text + len -1;
  26.  
  27.         if (    *pos++ == 't'
  28.              && *pos++ == 'y'
  29.              && *pos++ == 'p'
  30.              && *pos++ == 'e'
  31.              && *pos++ == 'd'
  32.              && *pos++ == 'e'
  33.              && *pos++ == 'f'
  34.              && *pos   == ' ' )
  35.         {
  36.             while (pos<=last && *++pos!=';');
  37.  
  38.             if (*pos == ';')
  39.             {
  40.                 ULONG len=0;
  41.  
  42.                 while (*--pos!=' ' && *pos!='*' && *pos!='&' )   len++;
  43.  
  44.                 *text = pos +1;
  45.  
  46.                 return (len);
  47.             }
  48.         }
  49.     }
  50.  
  51.  
  52.  
  53.     return 0;
  54. }
  55.